<%  unless @products.blank? %>
    $('#product-list').html('<%= escape_javascript(render :partial => 'product_list', :locals => { :products => @products }) %>');
    $('#product-pagination').html('<%= escape_javascript(will_paginate @products, :params => { :controller => "products", :action => "index" }) %>');
<% else %>
    $('#product-list').html('No hay productos que coincidan con los filtros seleccionados.');
    $('#product-pagination').html('');
<% end %>

<% if @selected %>
    $('.category[data-id="<%= @category %>"]').addClass('selected');
    $('.category[data-id="<%= @category %>"]').children('.deselect-category').first().show();
<% else %>
    $('.category[data-id="<%= @category %>"]').removeClass('selected');
    $('.category[data-id="<%= @category %>"]').children('.deselect-category').first().hide();
<% end %>

<% if !session[:selected_brand].blank? %>
    <% if session[:selected_brand] == 1 %>
        $('.brand[data-id="1"]').addClass('selected');
        $('.brand[data-id="1"]').children('.deselect-category').first().show();

        $('.brand[data-id="2"]').removeClass('selected');
        $('.brand[data-id="2"]').children('.deselect-category').first().hide();
    <% else %>
        $('.brand[data-id="2"]').addClass('selected');
        $('.brand[data-id="2"]').children('.deselect-category').first().show();

        $('.brand[data-id="1"]').removeClass('selected');
        $('.brand[data-id="1"]').children('.deselect-category').first().hide();
    <% end %>
<% else %>
        $('.brand[data-id="2"]').removeClass('selected');
        $('.brand[data-id="2"]').children('.deselect-category').first().hide();
        $('.brand[data-id="1"]').removeClass('selected');
        $('.brand[data-id="1"]').children('.deselect-category').first().hide();
<% end %>